<?php
namespace App\Params\H5;
use App\Params\Param;
/**
 * 订单列表查询参数
 *
 * @author: WangBin
 * @date: 2021/7/26
 * @mail: <849850352@qq.com>
 */
class OrderListParams extends Param
{
    public $data_type = 'all';
    public $page_size = 20;
    public $page = 1;
    public $customer_id;

    public function rules()
    {
        return [
            'data_type' => 'nullable|string',
            'page_size' => 'integer',
            'page' => 'integer|min:0',
            'customer_id' => 'required|integer'
        ];
    }

    /**
     * @return mixed
     */
    public function getCustomerId()
    {
        return $this->customer_id;
    }

    /**
     * @param mixed $customer_id
     */
    public function setCustomerId($customer_id): void
    {
        $this->customer_id = $customer_id;
    }

    /**
     * @return string
     */
    public function getDataType(): string
    {
        return (string)$this->data_type;
    }

    /**
     * @param string $data_type
     */
    public function setDataType(string $data_type): void
    {
        $this->data_type = $data_type;
    }

    /**
     * @return int
     */
    public function getPageSize(): int
    {
        return $this->page_size;
    }

    /**
     * @param int $page_size
     */
    public function setPageSize(int $page_size): void
    {
        $this->page_size = $page_size;
    }

    /**
     * @return int
     */
    public function getPage(): int
    {
        return $this->page > 0 ? --$this->page : $this->page;
    }

    /**
     * @param int $page
     */
    public function setPage(int $page): void
    {
        $this->page = $page;
    }
}
